/**
 * 项目名称（软件名称）：忠旺机械物资管理系统(mms)
 * 研发设计单位：忠旺机械设备制造有限公司机械设计院智能控制设计科设计与研发。
 * 版权所有：忠旺机械设备制造有限公司
 * 注：本项目的一切技术专利，使用规范归解释权由忠旺机械设备制造有限公司所有。
 * 软件版本：Ver 1.0.0
 * 文件路径：com.zhongwang.mms.module.purchase.dao
 * 创建时间：2020年04月03日 16时18分
 **/
package com.zhongwang.mms.module.purchase.dao;

import com.zhongwang.mms.gen.entity.PAllocationRecord;
import com.zhongwang.mms.gen.entity.PAllocationRecordExample;
import com.zhongwang.mms.module.purchase.model.PAllocationRecordCreateModel;
import com.zhongwang.mms.module.purchase.model.PAllocationRecordModel;
import com.zhongwang.mms.module.purchase.model.VWProject;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @ClassName： PAllocationRecordDao
 * @Description：
 * @Author： 徐一贺
 * @Date： 2020/4/3 16:18
 * @Version： V1.0
 **/
@Repository
public interface PurAllocationRecordDao {

    long countByExample(PAllocationRecordExample example);

    int deleteByExample(PAllocationRecordExample example);

    int deleteByPrimaryKey(Integer ardId);

    int insert(PAllocationRecord record);

    int insertSelective(PAllocationRecord record);

    List<PAllocationRecord> selectByExample(PAllocationRecordExample example);

    PAllocationRecord selectByPrimaryKey(Integer ardId);

    int updateByExampleSelective(@Param("record") PAllocationRecord record, @Param("example") PAllocationRecordExample example);

    int updateByExample(@Param("record") PAllocationRecord record, @Param("example") PAllocationRecordExample example);

    int updateByPrimaryKeySelective(PAllocationRecord record);

    int updateByPrimaryKey(PAllocationRecord record);
    /**
     *@FunctionName: delPAllocationRecordDataStatusBuPrimaryKey
     *@Description: 根据主键逻辑删除
     *@DesignIdea: 请填写设计思想
     *@Author: 徐一贺
     *@CreateDate: 2020/5/25 9:53
     *@Phone: 18241927380
     *@Param:
     *@Return:
     *@Throw:
     *@Version:
     */
    void delPAllocationRecordDataStatusBuPrimaryKey(Integer ardPid);
    /**
     *@FunctionName: delToUpdateByArdPid
     *@Description: 根据主键逻辑删除
     *@DesignIdea: 请填写设计思想
     *@Author: 徐一贺
     *@CreateDate: 2020/5/25 9:53
     *@Phone: 18241927380
     *@Param:
     *@Return:
     *@Throw:
     *@Version:
     */
    void delToUpdateByArdPid(Integer ardPid);
    /**
     *@FunctionName: findChildList
     *@Description: 获取子级别调拨记录列表
     *@DesignIdea: 请填写设计思想
     *@Author: 徐一贺
     *@CreateDate: 2020/5/25 9:53
     *@Phone: 18241927380
     *@Param:
     *@Return:
     *@Throw:
     *@Version:
     */
    List<PAllocationRecordModel> findChildList(PAllocationRecordModel param);
    /**
     *@FunctionName: findPAllocationRecordModelByPrimaryKey
     *@Description: 根据护肩获取调拨记录实体
     *@DesignIdea: 请填写设计思想
     *@Author: 徐一贺
     *@CreateDate: 2020/5/25 9:53
     *@Phone: 18241927380
     *@Param:
     *@Return:
     *@Throw:
     *@Version:
     */
    PAllocationRecordModel findPAllocationRecordModelByPrimaryKey(Integer ardId);
    /**
     *@FunctionName: updateByPAllocationRecordModelPrimaryKeySelective
     *@Description: 根据主键选择性的更新调拨记录
     *@DesignIdea: 请填写设计思想
     *@Author: 徐一贺
     *@CreateDate: 2020/5/25 9:54
     *@Phone: 18241927380
     *@Param:
     *@Return:
     *@Throw:
     *@Version:
     */
    int updateByPAllocationRecordModelPrimaryKeySelective(PAllocationRecordModel pAllocationRecordModel);
    /**
     *@FunctionName: execAllocation
     *@Description: 执行调拨
     *@DesignIdea: 请填写设计思想
     *@Author: 徐一贺
     *@CreateDate: 2020/5/25 9:55
     *@Phone: 18241927380
     *@Param:
     *@Return:
     *@Throw:
     *@Version:
     */
    void execAllocation(PAllocationRecordCreateModel param);

    /**
     *@FunctionName: updateByModel
     *@Description: 更新调拨记录的出入库单信息
     *@DesignIdea: 请填写设计思想
     *@Author: 徐一贺
     *@CreateDate: 2020/5/25 9:55
     *@Phone: 18241927380
     *@Param:
     *@Return:
     *@Throw:
     *@Version:
     */
    void updateByModel(PAllocationRecordModel pAllocationRecordModel);

    /**
     *@FunctionName: updateRequesterAndTakeWorkshopByFormCode
     *@Description: 更新申请者向欧盟西欧
     *@DesignIdea: 请填写设计思想
     *@Author: 徐一贺
     *@CreateDate: 2020/5/25 9:56
     *@Phone: 18241927380
     *@Param:
     *@Return:
     *@Throw:
     *@Version:
     */
    void updateRequesterAndTakeWorkshopByFormCode(PAllocationRecordModel param);
    /**
     *@FunctionName: findNoCreateOrderList
     *@Description: 获取没有创建的调拨单列表
     *@DesignIdea: 请填写设计思想
     *@Author: 徐一贺
     *@CreateDate: 2020/5/25 9:56
     *@Phone: 18241927380
     *@Param:
     *@Return:
     *@Throw:
     *@Version:
     */
    List<PAllocationRecordModel> findNoCreateOrderList(String account);
    /**
     *@FunctionName: findAllocationOutWarehouseRecordData
     *@Description: 获取未出库的调拨单列表
     *@DesignIdea: 请填写设计思想
     *@Author: 徐一贺
     *@CreateDate: 2020/5/25 9:57
     *@Phone: 18241927380
     *@Param:
     *@Return:
     *@Throw:
     *@Version:
     */
    List<PAllocationRecordModel> findAllocationOutWarehouseRecordData(PAllocationRecord pAllocationRecord);
    /**
     *@FunctionName: loadAllocationRecord
     *@Description: 加载调拨单
     *@DesignIdea: 请填写设计思想
     *@Author: 徐一贺
     *@CreateDate: 2020/5/25 9:58
     *@Phone: 18241927380
     *@Param:
     *@Return:
     *@Throw:
     *@Version:
     */
    List<PAllocationRecordModel> loadAllocationRecord(PAllocationRecord pAllocationRecord);
    /**
     *@FunctionName: findAllocationOrderListByPDBCodeAndArdType
     *@Description: 依据调拨单号和调拨单类型获取调拨记录列表
     *@DesignIdea: 请填写设计思想
     *@Author: 徐一贺
     *@CreateDate: 2020/5/25 9:58
     *@Phone: 18241927380
     *@Param:
     *@Return:
     *@Throw:
     *@Version:
     */
    List<PAllocationRecordModel> findAllocationOrderListByPDBCodeAndArdType(String odrCode);
    /**
     *@FunctionName: insertModelSelective
     *@Description: 选择性插入调拨记录
     *@DesignIdea: 请填写设计思想
     *@Author: 徐一贺
     *@CreateDate: 2020/5/25 9:58
     *@Phone: 18241927380
     *@Param:
     *@Return:
     *@Throw:
     *@Version:
     */
    void insertModelSelective(PAllocationRecordModel pAllocationRecordModel);
    /**
     *@FunctionName: findPAllocationRecordListByArdFormCode
     *@Description: 根据编号获取调拨单列表
     *@DesignIdea: 获取非删除的调拨单列表
     *@Author: 徐一贺
     *@CreateDate: 2020/5/19 16:38
     *@Phone: 18241927380
     *@Param: [odrCode] 调拨单号
     *@Return: [List<PAllocationRecord>] 非删除的调拨单列表
     *@Throw: 无异常抛出
     *@Version: v 1.0.0
     */
    List<PAllocationRecord> findPAllocationRecordListByArdFormCode(String odrCode);
    /**
     *@FunctionName: getPAllocationRecordBySelective
     *@Description: 根据各种条件获取调拨记录
     *@DesignIdea: 用来配合各种检索条件进行搜索调拨记录
     *@Author: 徐一贺
     *@CreateDate: 2020/5/20 8:13
     *@Phone: 18241927380
     *@Param: [param] 检索条件
     *@Return: [PAllocationRecord] 调拨记录
     *@Throw: 无异常抛出
     *@Version: v 1.0.0
     */
    PAllocationRecord getPAllocationRecordBySelective(PAllocationRecord param);

    /**
     *@FunctionName: deleteByPrimaryKeySelective
     *@Description: 物理删除调拨记录
     *@DesignIdea: 根据主键物理删除调拨记录
     *@Author: 徐一贺
     *@CreateDate: 2020/5/23 10:12
     *@Phone: 18241927380
     *@Version: 1.0.0
     */
    void deleteByPrimaryKeySelective(PAllocationRecord pAllocationRecord);
    /**
     *@FunctionName: deleteByArdFormCode
     *@Description: 物理删除调拨记录
     *@DesignIdea: 根据调拨单号物理删除调拨记录
     *@Author: 徐一贺
     *@CreateDate: 2020/5/23 10:12
     *@Phone: 18241927380
     *@Version: 1.0.0
     */
    void deleteByArdFormCode(String odrCode);
    /**
     *@FunctionName: deleteByArdFormCode
     *@Description: 物理删除调拨记录
     *@DesignIdea: 根据关系ID物理删除调拨记录
     *@Author: 徐一贺
     *@CreateDate: 2020/5/23 10:12
     *@Phone: 18241927380
     *@Version: 1.0.0
     */
    void deleteByArdRelationId(PAllocationRecord pAllocationRecord);

    /**
     *@FunctionName: selectByArdRelationIdAndArdType
     *@Description: 根据关系和类型获取实体
     *@DesignIdea: 请填写设计思想
     *@Author: 徐一贺
     *@CreateDate: 2020/5/23 16:33
     *@Phone: 18241927380
     *@Param: [pAllocationRecord.ArdRelationId] 关系id [pAllocationRecord.ArdType]类型
     *@Return: [PAllocationRecord] 实体
     *@Throw: 无返回类型
     *@Version: 1.0.0
     */
    List<PAllocationRecord> selectByArdRelationIdAndArdType(PAllocationRecord pAllocationRecord);
    /**
     *@FunctionName: findAllocationList
     *@Description: 获取调拨数据
     *@DesignIdea: 根据调拨单号和调拨类型获取调拨数据
     *@Author: 徐一贺
     *@CreateDate: 2020/5/25 14:58
     *@Phone: 18241927380
     *@Param: [param]
     *@Return: com.zhongwang.mms.common.JsonResult
     *@Throw: 无异常抛出
     *@Version: v 1.0.0
     */
    List<PAllocationRecordModel> findAllocationList(PAllocationRecordModel param);
    /**
     *@FunctionName: findAllocationSelfContainAndChildrenList
     *@Description: 根据ardPid获取子级以及自己的数据列表
     *@Author: 徐一贺
     *@CreateDate: 2020/5/25 16:41
     *@Phone: 18241927380
     *@Param: [param]
     *@Return: com.zhongwang.mms.common.JsonResult
     *@Version: v 1.0.0
     */
    List<PAllocationRecordModel> findAllocationSelfContainAndChildrenList(PAllocationRecordModel param);

    /**
     *@FunctionName: codeExist
     *@Description: 验证项目号是否存在
     *@DesignIdea: 验证项目号是否存在
     *@Author: 徐一贺
     *@CreateDate: 2020/5/26 10:02
     *@Phone: 18241927380
     *@Param: [param]
     *@Return: java.lang.String
     *@Version:  v 2.0.0
     */
    VWProject findVWProjectByCode(VWProject param);

    /**
     *@FunctionName: updatePurAllocationBytArdFormCode
     *@Description: 根据调拨单号更新领料人和领料车间
     *@DesignIdea: 根据调拨单号更新领料人和领料车间
     *@Author: 徐一贺
     *@CreateDate: 2020/5/26 10:02
     *@Phone: 18241927380
     *@Param: [param]
     *@Return: java.lang.String
     *@Version:  v 2.0.0
     */
    void updatePurAllocationBytArdFormCode(PAllocationRecordCreateModel param);
}